package com.dst.java_demo.core.configuration;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: LiJian
 * @Date: 2021/1/15 16:56
 */
@ConfigurationProperties(prefix = "demo")
@PropertySource(value = "classpath:config/exception-code.properties",encoding ="UTF-8")
@Component
@Getter
@Setter
public class ExceptionCodeConfiguration {
    private Map<Integer, String> codes = new HashMap<>();
    public String getMessage(int code){
        String message = codes.get(code);
        return message;
    }
}
